package net.tngou.iask.pojo;

import java.sql.Timestamp;
import java.util.Date;

import net.tngou.iask.util.StringUtil;

/**
 * 用户表
 * @author tngou@tngou.net
 *
 */
public class User extends POJO {
	private long main 	;// 	  	实体 
	private long role 	;//  	  	用户角色 0  普通登录用户 -1  
	private String avatar;// 头像
	private String  account 	;// 	  	  	账号，昵称 
	private String password 	;// 	  	  	登录密码 
	private String name 	;// 	  	  	姓名 
	private String phone 	;// 	  	  	电话/手机 
	private String email 	;// 	  	  	邮箱 
	private String position 	;// 	  	  	职位 
	private String openid 	;//	  	  	微信开放平台 
	private String access_token 	;//  	  	钥匙，做认证 
	private String refresh_token 	;//  	  	刷新，KEy 
	private int init;               // 密码是否需要重置：0（密码正常）、1（需要重新设置密码）
	private Timestamp time 	;//  	  	注册时间 
	public long getMain() {
		return main;
	}
	public void setMain(long main) {
		this.main = main;
	}
	public long getRole() {
		return role;
	}
	public void setRole(long role) {
		this.role = role;
	}
	public String getAccount() {
		return account;
	}
	public void setAccount(String account) {
		this.account = account;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getPosition() {
		return position;
	}
	public void setPosition(String position) {
		this.position = position;
	}
	public String getOpenid() {
		return openid;
	}
	public void setOpenid(String openid) {
		this.openid = openid;
	}
	public String getAccess_token() {
		return access_token;
	}
	public void setAccess_token(String access_token) {
		this.access_token = access_token;
	}
	public String getRefresh_token() {
		return refresh_token;
	}
	public void setRefresh_token(String refresh_token) {
		this.refresh_token = refresh_token;
	}
	public Timestamp getTime() {
		return time;
	}
	public void setTime(Timestamp time) {
		this.time = time;
	}
	public int getInit() {
		return init;
	}
	public void setInit(int init) {
		this.init = init;
	}
	public String getAvatar() {
		return avatar;
	}
	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}
	
	/**
	 * 头像
	 * @return
	 */
	public String Avatar() {
		if(StringUtil.isNotEmpty(this.avatar))
			return StringUtil.replace(this.avatar, "/", "", 1);	
		return "common/avatar/default_"+role+".png";
	}
	
}
